package com.wtf.dsp.admin.controller.api;


import com.wtf.dsp.admin.service.ExecuteSqlService;
import com.wtf.dsp.core.model.ExecSqlRequest;
import com.wtf.dsp.core.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: SqlPlatformController
 * Description:
 * date: 2023/7/7 16:43
 *
 * @author linhuanyou
 * @version 1.0
 */
@Api(tags = "SQL执行")
@RestController
@RequestMapping("/exec/mapper")
public class ExecuteSqlController {

    @Autowired
    private ExecuteSqlService executeSqlService;

    @ApiOperation(value = "SQL执行")
    @PostMapping("/sql")
    public R exec(@RequestBody ExecSqlRequest request) throws Exception {
        Object result = executeSqlService.exec(request);
        return R.ok(result);
    }
}
